import { ref, reactive } from "vue";

// 规范参数
interface IRuleForm {
  mobile: string,
  password: string,
}

export default function useFormProperties(t: any) {
  const activeName = ref("login");
  const loginText = ref(t("login.loginBtn"));
  const ruleForm: IRuleForm = reactive({
    mobile: "",
    password: ""
  });
  const rules = reactive({
    mobile: [{
      require: true,
      min: 11,
      max: 11,
      message: t("login.placeMobile"),
      trigger: "blur"
    }],
    password: [{
      require: true,
      message: t("login.placePass"),
      trigger: "blur"
    }]
  });
  const ruleFormRef = ref();

  return {
    activeName,
    loginText,
    ruleForm,
    rules,
    ruleFormRef
  };
}
